package com.cysion.study.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.cysion.study.R
import com.cysion.study.entity.AddressMapEntity
import com.cysion.study.ktbox.base.BaseAdapter
import com.cysion.study.ktbox.base.BaseViewHolder
import kotlinx.android.synthetic.main.item_map_p.view.*

class PMapAdapter(mEntities: MutableList<AddressMapEntity>, mContext: Context) :
    BaseAdapter<AddressMapEntity>(mEntities, mContext) {
    override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): BaseViewHolder<AddressMapEntity> {

        return ProMoneyHolder(
            LayoutInflater.from(mContext).inflate(R.layout.item_map_p, parent, false)
        )
    }

    class ProMoneyHolder(itemView: View) : BaseViewHolder<AddressMapEntity>(itemView) {
        override fun fillData(obj: AddressMapEntity, position: Int) {
            itemView?.apply {
                itemView.tv_title.text = obj.name
                itemView.tv_address.text = obj.address
                if (obj.check) {
                    itemView.iv_img.setImageResource(R.mipmap.icon_map_item_p)
                    itemView.tv_title.setTextColor(resources.getColor(R.color.main_cl))
                } else {
                    itemView.tv_title.setTextColor(resources.getColor(R.color.black))
                    itemView.iv_img.setImageResource(R.mipmap.icon_map_item_n)

                }
                /*Glide.with(context).load(obj.stuHeadImage).apply(
                    RequestOptions().placeholder(R.mipmap.default_head)
                ).into(itemView.iv_head)*/

                itemView.tv_address.setOnClickListener(View.OnClickListener {

                })
            }

        }

    }

}



